<%@ page import="com.entity.News" %>
<%@ page import="com.NewsService.NewsService" %>
<%@ page import="com.NewsServiceImpl.NewsServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/4/6
  Time: 11:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
        <%
                //接收数据
            request.setCharacterEncoding("utf-8");
            String id=request.getParameter("newsid");
            String title= request.getParameter("title");
            String summary= request.getParameter("summary");
            String content= request.getParameter("content");

            News news  = new News();
            news.setId(Integer.parseInt(id));
            news.setTitle(title);
            news.setSummary(summary);
            news.setContent(content);

            NewsService service = new NewsServiceImpl();
            int num= service.ServiceUpdateNews(news);
            if(num>0){
                response.sendRedirect(request.getContextPath()+"/index.jsp");
            }else {

         %>
             <div>修改失败</div>
         <%
            }

        %>

</body>
</html>
